<!--
 * @Author: Lizhen
 * @Date: 2023-08-11
 * @LastEditors: Lizhen
 * @LastEditTime: 2023-08-21
 * @FilePath: /vite-project/src/App.vue
 * @Description: 
-->
<script setup>
import { RouterLink, RouterView} from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import { useTimesStore } from '@/stores/times'
const { timesArr } = useTimesStore()
</script>

<template>
  <header>
    <img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />

    <div class="wrapper">
      <h2> some rules </h2>
      <p>1. 每天四次卡,包括上午上班前, 中午下班后, 下午上班前, 晚上下班后</p>
      <p>2. 中午两个卡 至少间隔30分钟 才都有效 否则按下班算</p>
      --{{ timesArr }}

      <nav>
        <RouterLink to="/">dashboard</RouterLink>
        <RouterLink to="/rules">rules</RouterLink>
      </nav>
    </div>
  </header>

  <router-view v-slot="{ Component }">
      <keep-alive >
        <component :is="Component" />
      </keep-alive>
    </router-view>


    <!-- <RouterView /> -->
  
</template>

<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

nav {
  width: 100%;
  font-size: 12px;
  text-align: center;
  margin-top: 2rem;
}

nav a.router-link-exact-active {
  color: #fff;
  background-color:hsla(160, 100%, 37%, 1);
}

nav a.router-link-exact-active:hover {
  background-color: transparent;
}

nav a {
  display: inline-block;
  padding: 0 1rem;
  border-left: 1px solid var(--color-border);
}

nav a:first-of-type {
  border: 0;
}

@media (min-width: 1024px) {

  .logo {
    margin: 0 2rem 0 0;
  }

  /* header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  } */

  nav {
    display: inline-block;
    text-align: left;
    font-size: 1rem;

    padding: 1rem 0;
    margin-top: 1rem;
  }
}
</style>
